package common.com.androidbase.okhttp;

import com.common.sdk.net.connect.interfaces.IResultParser;

import common.com.androidbase.datarequest.AbstractBaseModel;
import common.com.androidbase.datarequest.DataParseUtils;
import okhttp3.Response;

public class OkhttpResultParser implements IResultParser {

    Class<? extends AbstractBaseModel> cls;

    public OkhttpResultParser(Class<? extends AbstractBaseModel> cls) {
        this.cls = cls;
    }

    @Override
    public Object parse(Response response, String responseBody) throws Exception {
        Object data = DataParseUtils.parseCommonContent(cls, responseBody);
        return data;
    }
}
